/// @Classname : HcToastPage
/// @Author :
/// @Time : 2024-03-15 8:55
/// @Description : 弹窗展示页面

import 'package:flutter/material.dart';
import 'package:hc_ui/config/hc_customer_config.dart';
import 'package:hc_ui/theme/hc_common_theme.dart';
import 'package:hc_ui/utils/hc_toast_util.dart';
import 'package:hc_ui/widget/button/hc_elevated_button.dart';

class HcToastPage extends StatefulWidget {
  const HcToastPage({Key? key}) : super(key: key);

  @override
  State<HcToastPage> createState() => _HcToastPageState();
}

class _HcToastPageState extends State<HcToastPage> {
  HcCommonTheme theme = HcCustomerConfig().allTheme.commonTheme;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: theme.fillPageColor,
      appBar: AppBar(
        title: const Text("HcToast的演示"),
      ),
      body: Container(
        padding: EdgeInsets.symmetric(
            vertical: theme.vSpacingPage, horizontal: theme.hSpacingPage),
        child: ListView(
          children: [
            Padding(
              padding: EdgeInsets.only(top: theme.vSpacingBase),
              child: HcElevatedButton(
                onPressed: () => HcToastUtil.showToast(
                    context: context,
                    text: "这里是顶部弹出",
                    position: HcToastPosition.top),
                text: '顶部弹出',
              ),
            ),
            Padding(
              padding: EdgeInsets.only(top: theme.vSpacingBase),
              child: HcElevatedButton(
                onPressed: () => HcToastUtil.showSuccess(
                    context: context, text: "中部弹出成功的图标"),
                text: '中部弹出',
              ),
            ),
            Padding(
              padding: EdgeInsets.only(top: theme.vSpacingBase),
              child: HcElevatedButton(
                onPressed: () => HcToastUtil.showToast(
                    context: context,
                    icon: Icon(Icons.error_outline),
                    text: "这里是底部弹出",
                    position: HcToastPosition.bottom),
                text: '底部弹出',
              ),
            ),
            Padding(
              padding: EdgeInsets.only(top: theme.vSpacingBase),
              child: HcElevatedButton(
                onPressed: () =>
                    HcToastUtil.showLoading(context: context, text: "加载中..."),
                text: '我是Loading',
              ),
            ),
          ],
        ),
      ),
    );
  }
}
